<?php
// required
	include '../../kernel/kernel.php';

// safety check
	if(!isset($user) || !$user->isLoggedIn()) die();

// start js array
	echo 'var tinyMCELinkList = new Array('."\n\t";

// get pages
	$sql = "SELECT original_id, name
			FROM ".$db->module('pages')."
			WHERE language_id = '1'
			AND deleted = '0' AND published = '1'
			ORDER BY name
			";
	$res = mysql_query($sql) or $cosa->kill(mysql_error().'Could not fetch pages', 'db');
	$echo = '';
	while($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
		if(!empty($echo)) $echo .= ',';
		$echo .= '["'.stripslashes($row['name']).'", "http://%URL_PATH_TO@'.$row['original_id'].'%"]'."\n\t";
	}
	echo $echo;

// end js array
	echo "\n".');'."\n";

?>